Recognize functions and macros as defuns in 'cmake-ts-mode'
authorJörg Bornemann <foss@jbornemann.de>
Sat, 17 Feb 2024 20:18:02 +0000 (21:18 +0100)
committerEli Zaretskii <eliz@gnu.org>
Thu, 22 Feb 2024 13:02:20 +0000 (15:02 +0200)
commit6b6761d534259ab4d5409e72754e46af13623dda
tree92602d5a5b94af5c45dc31b391768a0714b12b0e
parent8e0f134653b2951e80cd5659fba5c36e416931fa
Recognize functions and macros as defuns in 'cmake-ts-mode'

* lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode--function-name):
Renamed to 'cmake-ts-mode--defun-name' since the function handles
now functions and macros.
(cmake-ts-mode--defun-name): Return text of the first 'argument'
node below 'function_def' and 'macro_def' nodes.
(cmake-ts-mode): Set up treesit-defun-type-regexp and
'treesit-defun-name-function'.  Change the imenu setup to
recognize macros too.  Since we have set up
'treesit-defun-name-function', we don't have to
pass 'cmake-ts-mode--function-name' anymore.  (Bug#69186)

To make `treesit-defun-at-point' work properly, we have to recognize
function_def/macro_def nodes, not the lower-level *_command nodes.
lisp/progmodes/cmake-ts-mode.el